<!--  -->
<template>
  <div class="school">
    <h3>学校名:{{name}}</h3>
    <h3>学校地址:{{address}}</h3>
    <button @click="send(name)">pubsub方式发送信息给Student</button>
  </div>
</template>

<script>
import pubsub from "pubsub-js"
export default {
  data () {
    return {
      name: "长春理工大学",
      address: '长春市朝阳区'
    }
  },
  methods: {
    send (name) {
      pubsub.publish("schoolName", name)
    }
  },
  //生命周期 - 创建完成（访问当前this实例）
  created () {

  },
  //生命周期 - 挂载完成（访问DOM元素）
  mounted () {

  }
}
</script>
<style scoped>
.school {
  width: 60%;
  height: 150px;
  background-color: lightpink;
  margin: 30px;
}
</style>